#ifndef X_D_H
#define X_D_H

#include "common.h"
template <AllegroVersion version>
struct x0D
{
    uint32_t t;
    uint32_t k;
    uint32_t str_ptr;
    uint32_t ptr2;     // Points to a random different `x0D`?
    int32_t coords[2]; // Relative to symbol origin
    uint32_t pad_ptr; // Points to `x1C`
    uint32_t un1;     // Always null?
    uint32_t bitmask;
    uint32_t rotation;
    
    uint32_t TAIL;
    operator x0D<A_174>() const;
    static constexpr AllegroVersion versions[2] = {A_172, A_174};
};

#if __cplusplus >= 202002L
template <AllegroVersion version> requires(version >= A_172)
struct x0D<version>
{
    uint32_t t;
    uint32_t k;
    uint32_t str_ptr;
    uint32_t ptr2;     // Points to a random different `x0D`?
    int32_t coords[2]; // Relative to symbol origin
    COND_FIELD(version >= A_174, uint32_t, un3);
    uint32_t pad_ptr; // Points to `x1C`
    uint32_t un1;     // Always null?
    uint32_t un2;
    uint32_t bitmask;
    uint32_t rotation;

    uint32_t TAIL;
    operator x0D<A_174>() const;
    static constexpr AllegroVersion versions[2] = {A_172, A_174};
};
#else
template <> struct x0D<A_172>
{
    uint32_t t;
    uint32_t k;
    uint32_t str_ptr;
    uint32_t ptr2;     // Points to a random different `x0D`?
    int32_t coords[2]; // Relative to symbol origin
    uint32_t pad_ptr; // Points to `x1C`
    uint32_t un1;     // Always null?
    uint32_t un2;
    uint32_t bitmask;
    uint32_t rotation;

    uint32_t TAIL;
    operator x0D<A_174>() const;
    static constexpr AllegroVersion versions[2] = {A_172, A_174};
};

template <> struct x0D<A_174>
{
    uint32_t t;
    uint32_t k;
    uint32_t str_ptr;
    uint32_t ptr2;     // Points to a random different `x0D`?
    int32_t coords[2]; // Relative to symbol origin
    uint32_t un3;
    uint32_t pad_ptr; // Points to `x1C`
    uint32_t un1;     // Always null?
    uint32_t un2;
    uint32_t bitmask;
    uint32_t rotation;

    uint32_t TAIL;
    operator x0D<A_174>() const;
    static constexpr AllegroVersion versions[2] = {A_172, A_174};
};
#endif

#endif // X_D_H
